#include <iostream>
using namespace std;

class Date
{
public:
    Date(int year = 1, int month = 1, int day = 1);
    bool operator==(const Date &d) const;
    bool operator!=(const Date &d) const;
    bool operator<(const Date &d) const;
    bool operator<=(const Date &d) const;
    Date &operator=(const Date &d);
    bool operator>(const Date &d) const;
    bool operator>=(const Date &d) const;

    Date operator+(int day) const;
    Date &operator+=(int day);
    Date operator-(int day) const;
    Date &operator-=(int day);

    Date &operator++();
    Date operator++(int);

    void Print() const
    {
        cout << _year << "-" << _month << "-" << _day << endl;
    }
    int operator-(const Date &d) const
    {
        int flag = 1;
        Date max = *this;
        Date min = d;
        if (*this < d)
        {
            max = d;
            min = *this;
            flag = -1;
        }
        int n = 0;
        while (min != max)
        {
            ++min;
            ++n;
        }
        return n * flag;
    }

    int GetMonthDay(int year, int month) const
    {
        assert(month > 0 && month < 13);
        int monthDays[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        if (month == 2 && ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0))
        {
            return 29;
        }
        return monthDays[month];
    }
    friend ostream &operator<<(ostream &_cout, const Date &d);
    // void operator<<(ostream &_cout);
    friend istream &operator>>(istream &_cin, const Date &d);

private:
    int _year;
    int _month;
    int _day;
};